<?php
/* FILE: process_search_collections.php
 * DESCRIPTION: Process called when the search button is pressed on collection_list.php
 * POST DATA: cname, cdesc, cuser, crate
 * GET DATA: N/A
 */ 
	session_start();

	include('config.inc');

	//Get all POST variables
	$sortby = $_GET['sb'];
	$collection = urlencode(trim($_POST['cname']));
	$description = urlencode(trim($_POST['cdesc']));
	$owner = urlencode(trim($_POST['cuser']));
	switch((string)$_POST['crate'])
	{
		case 'zero': $rating = "0"; break;
		case 'one': $rating = "1"; break;
		case 'two': $rating = "2"; break;
		case 'thr': $rating = "3"; break;
		case 'four': $rating = "4"; break;
		case 'five': $rating = "5"; break;
		default: $rating = ""; break;	//Rating not chosen to search by
	}
	
	//Send search criteria via URL
	header
	(
		'Location: collection_list.php?sb='.$sortby
		. ($collection != "" ? '&cn='.$collection : '')
		. ($description != "" ? '&cd='.$description : '')
		. ($rating != "" ? '&cr='.$rating : '')
		. ($owner != "" ? '&co='.$owner : '')
	);
	
?>